using UnityEngine;

public class RotateObject : MonoBehaviour
{
	private float f_lastX;

	private float f_difX = 0.5f;

	private float f_steps;

	private int i_direction = 1;

	public GarageController GarageController;

	public void Rotate()
	{
		if (Input.GetMouseButtonDown(0))
		{
			f_difX = 0f;
		}
		else if (Input.GetMouseButton(0))
		{
			f_difX = Mathf.Abs(f_lastX - UnityEngine.Input.GetAxis("Mouse X"));
			if (f_lastX < UnityEngine.Input.GetAxis("Mouse X"))
			{
				i_direction = -1;
				GarageController.CurrentVehicle().Rotate(Vector3.up, 0f - f_difX);
			}
			if (f_lastX > UnityEngine.Input.GetAxis("Mouse X"))
			{
				i_direction = 1;
				GarageController.CurrentVehicle().Rotate(Vector3.up, f_difX);
			}
			f_lastX = 0f - UnityEngine.Input.GetAxis("Mouse X");
		}
		else
		{
			if (f_difX > 0.5f)
			{
				f_difX -= 0.05f;
			}
			if (f_difX < 0.5f)
			{
				f_difX += 0.05f;
			}
			GarageController.CurrentVehicle().Rotate(Vector3.up, f_difX * (float)i_direction);
		}
	}
}
